package com.atguigu.spzx.manager.properties;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "spzx.minio")
@Data
public class SpzxMinioProperties implements InitializingBean {
    private String endpoint;//: http://192.168.1.170:9001
    private String accessKey;//: admin
    private String secretKey;//: admin123456
    private String bucket;//: spzx

    public static String ENDPOINT;
    public static String ACCESS_KEY;
    public static String SECRET_KEY;
    public static String BUCKET;
    //在容器初始化当前类的对象并初始化属性值之后，将该对象的成员属性值设置给静态属性
    @Override
    public void afterPropertiesSet() throws Exception {
        ENDPOINT = this.getEndpoint();
        ACCESS_KEY = this.getAccessKey();
        SECRET_KEY = this.getSecretKey();
        BUCKET = this.getBucket();
    }



//    public SpzxMinioProperties() {
//        ENDPOINT = this.getEndpoint();
//    }
}
